import * as constants from '../Constants'
import { 
  get, 
  GET_USER_MENU, 
  GET_SYS_CATEGORYS, 
  GET_BANDS, 
  GET_COOPER, 
  GET_CENTER_CATEGORY,
  GET_MIN_CATEGORY, 
  GET_ERP_SHOP,
  GET_BASE_INFO,
  GET_VENDER_LIST,
  GET_EXPName_LIST,
  GET_BUYER_LIST,
  GET_STATUS_LIST,
  GET_reSTATUS_LIST,
  GET_LAYOUT_LIST,
  GET_STYLE_LIST,
  GET_COLORS,
  GET_SIZES,
  GET_SCORE_LIST,
  GET_PHOTO_CHECK_LIST } from '../../service/api'

export interface Collapsed {
  type: constants.Collapsed
}
export interface GetUserMenu {
  type: constants.GetUserMenu
  payload: Promise<any>
}
export interface GetUserMenu_FULFILLED {
  type: constants.GetUserMenu_FULFILLED
  payload: Array<any>
}
export interface ChangeTopMenu {
  type: constants.ChangeTopMenu
  payload: number
}
export interface InitCategory {
  type: constants.InitCategory
  payload: Promise<any>
}
export interface InitCategory_FULFILLED {
  type: constants.InitCategory_FULFILLED
  payload: Array<any>
}
export interface InitMinCategory {
  type: constants.InitMinCategory
  payload: Promise<any>
}
export interface InitMinCategory_FULFILLED {
  type: constants.InitMinCategory_FULFILLED
  payload: Array<any>
}
export interface InitBand {
  type: constants.InitBand
  payload: Promise<any>
}
export interface InitBand_FULFILLED {
  type: constants.InitBand_FULFILLED
  payload: Array<any>
}
export interface InitCooper {
  type: constants.InitCooper
  payload: Promise<any>
}
export interface InitCooper_FULFILLED {
  type: constants.InitCooper_FULFILLED
  payload: Array<any>
}

export interface InitCenterCategory {
  type: constants.InitCenterCategory
  payload: Promise<any>
}
export interface InitCenterCategory_FULFILLED {
  type: constants.InitCenterCategory_FULFILLED
  payload: Array<any>
}
export interface InitBaseInfo {
  type: constants.InitBaseInfo
  payload: Promise<any>
}
export interface InitBaseInfo_FULFILLED {
  type: constants.InitBaseInfo_FULFILLED
  payload: Array<any>
}

export interface InitErpShop {
  type: constants.InitErpShop
  payload: Promise<any>
}
export interface InitErpShop_FULFILLED {
  type: constants.InitErpShop_FULFILLED
  payload: Array<any>
}

export interface InitVender {
  type: constants.InitVender
  payload: Promise<any>
}
export interface InitVender_FULFILLED {
  type: constants.InitVender_FULFILLED
  payload: Array<any>
}

export interface InitEXPName {
  type: constants.InitEXPName
  payload: Promise<any>
}
export interface InitEXPName_FULFILLED {
  type: constants.InitEXPName_FULFILLED
  payload: Array<any>
}

export interface InitBuyer {
  type: constants.InitBuyer
  payload: Promise<any>
}
export interface InitBuyer_FULFILLED {
  type: constants.InitBuyer_FULFILLED
  payload: Array<any>
}

export interface InitStatus {
  type: constants.InitStatus
  payload: Promise<any>
}
export interface InitStatus_FULFILLED {
  type: constants.InitStatus_FULFILLED
  payload: Array<any>
}
export interface InitreStatus {
  type: constants.InitreStatus
  payload: Promise<any>
}
export interface InitreStatus_FULFILLED {
  type: constants.InitreStatus_FULFILLED
  payload: Array<any>
}
export interface InitLAYOU {
  type: constants.InitLAYOU
  payload: Promise<any>
}
export interface InitLAYOU_FULFILLED {
  type: constants.InitLAYOU_FULFILLED
  payload: Array<any>
}
export interface InitStyle {
  type: constants.InitStyle
  payload: Promise<any>
}
export interface InitStyle_FULFILLED {
  type: constants.InitStyle_FULFILLED
  payload: Array<any>
}

export interface InitColors {
  type: constants.InitColors
  payload: Promise<any>
}

export interface InitColors_FULFILLED {
  type: constants.InitColors_FULFILLED
  payload: Array<any>
}

export interface InitSizes {
  type: constants.InitSizes
  payload: Promise<any>
}

export interface InitSizes_FULFILLED {
  type: constants.InitSizes_FULFILLED
  payload: Array<any>
}

export interface InitCheckList {
  type: constants.InitCheckList
  payload: Promise<any>
}

export interface InitCheckList_FULFILLED {
  type: constants.InitCheckList_FULFILLED
  payload: Array<any>
}

export interface InitScoreList {
  type: constants.GetSOCRELIST
  payload: Promise<any>
}

export interface InitScoreList_FULFILLED {
  type: constants.GetSOCRELIST_FULFILLED
  payload: Array<any>
}

export type SettingAction = GetUserMenu | 
  Collapsed | 
  GetUserMenu_FULFILLED | 
  ChangeTopMenu | 
  InitCategory | 
  InitCategory_FULFILLED | 
  InitBand |
  InitBand_FULFILLED |
  InitCooper |
  InitCooper_FULFILLED |
  InitCenterCategory |
  InitCenterCategory_FULFILLED |
  InitBaseInfo |
  InitBaseInfo_FULFILLED |
  InitMinCategory |
  InitMinCategory_FULFILLED |
  InitErpShop |
  InitErpShop_FULFILLED |
  InitVender |
  InitVender_FULFILLED |
  InitEXPName |
  InitEXPName_FULFILLED |
  InitBuyer |
  InitBuyer_FULFILLED |
  InitStatus |
  InitStatus_FULFILLED |
  InitreStatus |
  InitreStatus_FULFILLED |
  InitLAYOU |
  InitLAYOU_FULFILLED |
  InitStyle |
  InitStyle_FULFILLED |
  InitColors |
  InitColors_FULFILLED |
  InitSizes |
  InitSizes_FULFILLED |
  InitCheckList |
  InitCheckList_FULFILLED |
  InitScoreList |
  InitScoreList_FULFILLED

//左边菜单收缩
export function collapsed(): Collapsed {
  return {
    type: constants.Collapsed
  }
}
//顶部菜单切换
export function changeTopMenu (index: number): ChangeTopMenu {
  return {
    type: constants.ChangeTopMenu,
    payload: index
  }
}
//获取用户菜单
export function getUserMenu(token: string): GetUserMenu {
  return {
    type: constants.GetUserMenu,
    payload: get(GET_USER_MENU, { token })
  }
}

//获取初始化数据
export function initCategory(): InitCategory {
  return {
    type: constants.InitCategory,
    payload: get(GET_SYS_CATEGORYS)
  }
}

export function initBand(): InitBand {
  return {
    type: constants.InitBand,
    payload: get(GET_BANDS)
  }
}

export function initCooper(): InitCooper {
  return {
    type: constants.InitCooper,
    payload: get(GET_COOPER)
  }
}

export function initErpShop(): InitErpShop {
  return {
    type: constants.InitErpShop,
    payload: get(GET_ERP_SHOP)
  }
}

export function initCenterCategory(): InitCenterCategory {
  return {
    type: constants.InitCenterCategory,
    payload: get(GET_CENTER_CATEGORY)
  }
}

export function initMinCategory(): InitMinCategory {
  return {
    type: constants.InitMinCategory,
    payload: get(GET_MIN_CATEGORY)
  }
}

export function initBaseInfo(param: any): InitBaseInfo {
  return {
    type: constants.InitBaseInfo,
    payload: get(GET_BASE_INFO, param)
  }
}

export function initVender(): InitVender {
  return {
    type: constants.InitVender,
    payload: get(GET_VENDER_LIST)
  }
}
export function InitEXPName(): InitEXPName {
  return {
    type: constants.InitEXPName,
    payload: get(GET_EXPName_LIST)
  }
}

export function initBuyer(): InitBuyer {
  return {
    type: constants.InitBuyer,
    payload: get(GET_BUYER_LIST)
  }
}

export function initStatus(): InitStatus {
  return {
    type: constants.InitStatus,
    payload: get(GET_STATUS_LIST)
  }
}

export function InitreStatus(): InitreStatus {
  return {
    type: constants.InitreStatus,
    payload: get(GET_reSTATUS_LIST)
  }
}

export function InitLAYOU(): InitLAYOU {
  return {
    type: constants.InitLAYOU,
    payload: get(GET_LAYOUT_LIST,{type:"hotlevel"})
  }
}
export function initStyle(): InitStyle {
  return {
    type: constants.InitStyle,
    payload: get(GET_STYLE_LIST)
  }
}

export function initColors(): InitColors {
  return {
    type: constants.InitColors,
    payload: get(GET_COLORS)
  }
}

export function initSizes(): InitSizes {
  return {
    type: constants.InitSizes,
    payload: get(GET_SIZES)
  }
}
export function InitCheckList(): InitCheckList {
  return {
    type: constants.InitCheckList,
    payload: get(GET_PHOTO_CHECK_LIST)
  }
}

export function initScoreList(): InitScoreList {
  return {
    type: constants.GetSOCRELIST,
    payload: get(GET_SCORE_LIST)
  }
}
